package cn.gson.crm.model.dao;

import cn.gson.crm.model.pojos.Sales;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface SalesDao extends CrudRepository<Sales,Long> {
    //主页漏斗
    @Query(nativeQuery = true,value = "select count(*) from SALES s INNER JOIN CUSTOMER b ON s.CUSTOMER_ID=b.CUSTOMER_ID INNER JOIN EMPLOYEE c on b.YG_ID=c.YG_ID where s.SALES_STATUS='跟踪' and TO_CHAR(s.SALES_SIGN_DATE,'yyyy') like '%2020%' and s.SALES_STAGE =?1")
    public Integer select1(String stage);
    //主页漏斗2
    @Query(nativeQuery = true,value = "select count(*) from SALES s INNER JOIN CUSTOMER b ON s.CUSTOMER_ID=b.CUSTOMER_ID INNER JOIN EMPLOYEE c on b.YG_ID=c.YG_ID where s.SALES_STATUS='跟踪' and TO_CHAR(s.SALES_SIGN_DATE,'yyyy') like '%2019%' and s.SALES_STAGE =?1 ")
    public Integer select2(String stage);

}
